public class Solution1128 {
    public int numEquivDominoPairs(int[][] dominoes) {
        int[] f=new int[100];
        int ans=0;
        for (int[] dominoe : dominoes) {
            int d=Math.min(dominoe[0],dominoe[1])*10+Math.max(dominoe[0],dominoe[1]);
            ans=ans+f[d];
            f[d]++;
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1128().numEquivDominoPairs(new int[][]{{1,2},{2,1},{3,4},{5,6}}));
    }
}
